<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="ja" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>景区编集</title>
<base target="_self" />
<style type="text/css">
</style>
<%@ include file="../common/top.jsp"%>
<link href="${appPath}/css/nav.css" rel="stylesheet" type="text/css" />
<link href="${appPath}/css/userInfoList.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${appPath}/js/userInfoList.js"></script>
<script type="text/javascript" src="${appPath}/js/year_month_day.js"></script>
<script type="text/javascript">
$(function(){
    $("#btnSave").click( function (){
    	document.forms[0].action = appPath+"/webgoods/saveGoodsEdit.action";
    	document.forms[0].submit();
    });
    $("#btnAdd").click( function (){
    	document.forms[0].action = appPath+"/webgoods/saveGoodsAdd.action";
    	document.forms[0].submit();
    });
    $("input[id^=delBtn][type=button]").each(function(i) {
    	$(this).click(function() {
    		$("#delIndex").val(i);
    		document.forms[0].action = appPath+"/webgoods/saveGoodsDel.action";
    		document.forms[0].submit();
    	});
	});
    
});

</script>
</head>

<body>
	<div id="content">

		<p class="space2"></p>
		<h1 class="" style="background:#43B413;color:#fff;height:40px;">
			<s:if test='id !=null && id !=""'>
				景区编集
			</s:if>
			<s:else>
				景区新增
			</s:else>
			&nbsp;&nbsp;&nbsp;&nbsp;
		</h1>
		<s:fielderror fieldName="textOverLimit"></s:fielderror>
		<s:fielderror fieldName="usernameMult"></s:fielderror>
		
		<s:form action="" id="goodsForm" enctype="multipart/form-data" method="post">
			<s:hidden id="" name="id"/>
			<s:hidden id="delIndex" name="delIndex"/>
			<s:hidden id="" name="resortDto.id"/>
			<table class="userTable" style="background: white; width: 860px; margin-left: auto; margin-right: auto;">
                
				<tr>
				    <td rowspan="5" width="30%"><s:hidden name="resortDto.imageUrl"/><sys:image imagePath="${resortDto.imageUrl}"  width="200" height="200"></sys:image>
				    <s:file name="resortDto.imageFile" theme="simple" label="景区图片选择"></s:file> </td>
					<td height="50px" width="20%" align="right" class="font1">名称</td>
					<td height="50px" width="30%" align="left">
							<s:textarea	id="name" name="resortDto.name"  cols="50" rows="4" cssStyle="margin-left:10px;"/> <s:fielderror	fieldName="resortDto.name" cssClass="checkmessage"></s:fielderror>
					</td>
					<td align="left" width="20%">&nbsp;<s:fielderror fieldName="resortDto.name"
								cssClass="errormessage"></s:fielderror> </td>
				</tr>
				<tr>
					<td height="50px" align="right" class="font1">概述</td>
					<td height="50px" align="left"><s:textarea	id="introduce" name="resortDto.introduce"  cols="50" rows="5" cssStyle="margin-left:10px;"/> <s:fielderror	fieldName="resortDto.introduce" cssClass="checkmessage"></s:fielderror></td>
					<td align="left"><s:fielderror fieldName="resortDto.introduce"
								cssClass="errormessage"></s:fielderror>
					</td>
				</tr>
				
				<%-- <tr>
					<td height="50px" align="right" class="font1">区域</td>
					<td height="50px" align="left"><s:select id="areaMap" name="resortDto.areaId"
								list="areaMap" listKey="key" listValue="value" cssStyle="margin-left:10px;width:50px;"/><s:select id="areaMap2" name="resortDto.areaId2"
								list="areaMap2" listKey="key" listValue="value"  cssStyle="width:50px;"/></td>
					<td align="left"><s:fielderror fieldName="resortDto.latitude"
								cssClass="errormessage"></s:fielderror>
					</td>
				</tr> --%>
				
				<%-- <tr>
					<td height="50px" align="right" class="font1">开放时间</td>
					<td height="50px" align="left"><s:textfield type="text" cssClass="sTxt" id="worktime"
							name="resortDto.worktime" maxlength="20" onblur="" /></td>
					<td align="left"><s:fielderror fieldName="resortDto.worktime"
								cssClass="errormessage"></s:fielderror>
					</td>
				</tr>
				<tr> --%>
					<td height="50px" align="right" class="font1">经度</td>
					<td height="50px" align="left"><s:textfield type="text" cssClass="sTxt" id="longitude"
							name="resortDto.longitude" maxlength="20" onblur="" /></td>
					<td align="left"><s:fielderror fieldName="resortDto.longitude"
								cssClass="errormessage"></s:fielderror>
					</td>
				</tr>
				<tr>
					<td height="50px" align="right" class="font1">纬度</td>
					<td height="50px" align="left"><s:textfield type="text" cssClass="sTxt" id="latitude"
							name="resortDto.latitude" maxlength="20" onblur="" /></td>
					<td align="left"><s:fielderror fieldName="resortDto.latitude"
								cssClass="errormessage"></s:fielderror>
					</td>
				</tr>
				<tr>
					<td height="50px" align="right" class="font1">门票价格</td>
					<td height="50px" align="left"><s:textfield type="text" cssClass="sTxt" id="inputPrice"
							name="resortDto.inputPrice" maxlength="6" onblur="" cssStyle="ime-mode:disabled"/></td>
					<td align="left"><s:fielderror fieldName="resortDto.inputPrice"
								cssClass="errormessage"></s:fielderror>
					</td>
				</tr>
          </table>
          <hr style="widht:600px;"/>
          <s:iterator value="resortDto.attractionsList" id="attractionsList" status="st">
          <br/>
          <table class="userTable" style="background: white; width: 860px; margin-left: auto; margin-right: auto;box-shadow: #ddd 0px 2px 8px;">
         	 <tr>
         	        <td rowspan="4"  width="30%"><s:hidden name="resortDto.attractionsList[%{#st.index}].imageUrl"/><sys:image imagePath="${imageUrl}"  width="200" height="200"/>
         	        <s:file name="resortDto.attractionsList[%{#st.index}].imageFile" theme="simple"  label="景点图片选择"></s:file></td>
					<td height="50px" width="20%" align="right" class="font1">名称</td>
					<td height="50px" width="30%" align="left">
							<s:textarea	id="attractionsListName{#st.index}" name="resortDto.attractionsList[%{#st.index}].name"  cols="50" rows="4" cssStyle="margin-left:10px;"/> <s:fielderror	fieldName="resortDto.attractionsList[%{#st.index}].name" cssClass="checkmessage"></s:fielderror>
					</td>
					<td align="left" width="20%">&nbsp;<s:fielderror fieldName="resortDto.attractionsList[%{#st.index}].name"
								cssClass="errormessage"></s:fielderror></td>
				</tr>
				<tr>
					<td height="50px" align="right" class="font1">概述</td>
					<td height="50px" align="left"><s:textarea	id="attractionsListIntroduce{#st.index}." name="resortDto.attractionsList[%{#st.index}].introduce"  cols="50" rows="5" cssStyle="margin-left:10px;"/> <s:fielderror	fieldName="resortDto.attractionsList[%{#st.index}].introduce" cssClass="checkmessage"></s:fielderror></td>
					<td align="left"><s:fielderror fieldName="resortDto.attractionsList[%{#st.index}].introduce"
								cssClass="errormessage"></s:fielderror>
					</td>
				</tr>
				<tr>
					<td height="50px" align="right" class="font1">经度</td>
					<td height="50px" align="left"><s:textfield type="text" cssClass="sTxt" id="attractionsLongitude{#st.index}"
							name="resortDto.attractionsList[%{#st.index}].longitude" maxlength="20" onblur="" /></td>
					<td align="left"><s:fielderror fieldName="resortDto.attractionsList[%{#st.index}]"
								cssClass="errormessage"></s:fielderror>
					</td>
				</tr>
				<tr>
					<td height="50px" align="right" class="font1">纬度</td>
					<td height="50px" align="left"><s:textfield type="text" cssClass="sTxt" id="attractionsLatitude{#st.index}"
							name="resortDto.attractionsList[%{#st.index}].latitude" maxlength="20" onblur="" /></td>
					<td align="left" width="20%"><input type="button" id="delBtn%{#st.index}" value="删除" class="button1" style="width:50px;"/>
					<s:fielderror fieldName="resortDto.attractionsList[%{#st.index}].latitude"
								cssClass="errormessage"></s:fielderror>
					</td>
				</tr>
		  </table>
          </s:iterator>

          <table class="userTable" style="background: white; width: 860px; margin-left: auto; margin-right: auto;">
          		<tr>
					<td height="100px" align="right" colspan="3">
							<input type="button" id="btnAdd" value="添加" class="button1" style="width:50px;"/>
						</td>
				</tr>
				<tr>
					<td height="100px" align="center" colspan="3"><s:if test='id !=null && id !=""'>
							<input type="button" id="btnSave" value="保存" class="button1" style="width:300px;"/>
						</s:if> <s:else>
							<input type="button" id="btnSave" value="保存" class="button1" style="width:300px;"/>
						</s:else></td>
				</tr>
			</table>

			<s:hidden id="usernameAgainMsg" value="%{getText('label_usernameAgainMsg')}" name=""></s:hidden>
			<s:hidden id="passwordSureErrorMsg" value="%{getText('label_passwordSureErrorMsg')}" name="passwordSureErrorMsg"></s:hidden>
		</s:form>
	</div>
<%@ include file="../common/footer.jsp"%>
	<p class="space1"></p>
	<script type="text/javascript">
		$(function() {
			var selYear = window.document.getElementById("selYear");
			var selMonth = window.document.getElementById("selMonth");
			var selDay = window.document.getElementById("selDay");
			var modifyflag = "<s:property value="userForModify"/>";
			var dt;
			if (modifyflag == "1") {
				dt = new Date("<s:property value="selYear"/>", "<s:property value="selMonth"/>" - 1, "<s:property value="selDay"/>");
			} else {
				dt = new Date();
			}

			new DateSelector(selYear, selMonth, selDay, dt);
		});
	</script>
</body>
</html>